Skip to content

[python] test infra improvements#10219

Merged
iscai-msft merged 53 commits intomicrosoft:mainfrom
iscai-msft:python/testInfraImprovements
Apr 6, 2026
Merged

[python] test infra improvements#10219
iscai-msft merged 53 commits intomicrosoft:mainfrom
iscai-msft:python/testInfraImprovements

Conversation

@iscai-msft
Copy link
Copy Markdown
Member

@iscai-msft iscai-msft commented Mar 31, 2026

Summary

Infrastructure overhaul for cleaner code organization and faster CI.

New Folder Structure

http-client-python/
├── emitter/                        # TypeScript emitter (unchanged)
├── generator/pygen/                # Python generator (unchanged)
│
├── tests/                          # Consolidated test infrastructure
│   ├── tox.ini                     # Unified tox config with uv for faster installs
│   ├── conftest.py                 # Root pytest fixtures
│   ├── requirements/
│   │   ├── base.txt                # pytest, pytest-asyncio, coverage
│   │   ├── lint.txt                # pylint
│   │   ├── typecheck.txt           # mypy, pyright
│   │   ├── docs.txt                # sphinx, apiview
│   │   ├── azure.txt               # azure-core, azure-mgmt-core
│   │   └── unbranded.txt           # corehttp
│   ├── mock_api/                   # Mock API tests
│   │   ├── azure/                  # Azure-specific tests
│   │   ├── unbranded/              # Unbranded-specific tests
│   │   └── shared/                 # Shared test utilities
│   ├── unit/                       # Unit tests for pygen internals
│   └── generated/                  # Generated SDK packages
│       ├── azure/                  # Azure flavor packages
│       └── unbranded/              # Unbranded flavor packages
│
├── eng/scripts/                    # TypeScript-based tooling
│   ├── ci/
│   │   ├── run-tests.ts            # Parallel test orchestrator
│   │   ├── lint.ts                 # ESLint + pylint runner
│   │   ├── typecheck.ts            # mypy + pyright runner
│   │   ├── format.ts               # Prettier + Black runner
│   │   ├── regenerate.ts           # SDK regeneration
│   │   ├── regenerate-common.ts    # Shared regeneration utilities
│   │   ├── run_pylint.py           # Pylint helper for generated SDKs
│   │   ├── run_mypy.py             # Mypy helper for generated SDKs
│   │   ├── run_pyright.py          # Pyright helper for generated SDKs
│   │   └── config/                 # Tool configurations
│   │       ├── pylintrc
│   │       ├── mypy.ini
│   │       └── pyrightconfig.json
│   └── setup/
│       ├── build.ts                # Build pygen wheel
│       ├── install.ts              # Install dependencies
│       └── prepare.ts              # Prepare environment
│
└── dist/                           # Compiled emitter output

Key Changes

npm Scripts

Command Description
npm run test Run all tests (emitter + generator)
npm run test:emitter TypeScript emitter tests (vitest)
npm run test:generator Python generator tests (tox)
npm run lint Lint emitter (ESLint) + pygen source (pylint)
npm run lint:generated Lint generated SDK packages
npm run typecheck Type check pygen source (mypy + pyright)
npm run typecheck:generated Type check generated SDK packages
npm run format Format emitter (Prettier) + pygen (Black)
npm run format:generated Format generated SDK packages
npm run regenerate Regenerate all SDK packages

Speed Improvements

  • uv package installer: ~5-10x faster than pip for installing generated packages
  • Parallel test execution: Tests run in parallel across CPU cores
  • Separated source vs generated validation: Default commands only run on source code for faster dev loop

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

All changed packages have been documented.

  • @typespec/http-client-python
Show changes

@typespec/http-client-python - internal ✏️

Clean up test infrastructure, run in parallel, and use uv pip when acceptable. CI runs 2-3 x faster

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Mar 31, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 31, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10219

commit: 72f8762

@iscai-msft iscai-msft enabled auto-merge April 3, 2026 18:51
@iscai-msft iscai-msft disabled auto-merge April 3, 2026 19:56
@iscai-msft iscai-msft enabled auto-merge April 3, 2026 20:25
@iscai-msft iscai-msft added this pull request to the merge queue Apr 6, 2026
Merged via the queue into microsoft:main with commit 03b8f4c Apr 6, 2026
53 checks passed
@iscai-msft iscai-msft deleted the python/testInfraImprovements branch April 6, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python eng

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants